package org.shiki.hrm.controller;

import org.shiki.hrm.util.AjaxResult;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SuccessController {

	@PostMapping("/success")
	public AjaxResult success(){
		SecurityContext context = SecurityContextHolder.getContext();
		Authentication authentication = context.getAuthentication();
		System.out.println(authentication);
		return AjaxResult.me().setMessage(authentication.getPrincipal() + "--------OK---------");
	}

}
